{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="{% static 'jquery/jquery.min.js' %}"></script>
    <script src="{% static 'bootstrap/js/bootstrap.min.js'%}"></script>
</head>
<body>
    <form action="/cv/" method="post">
        <a href="#" class="captcha">
            <img src="{{ captcha.image_url }}" alt="点击切换" id="id_captcha" >
        </a> <br>
        <input type="text" name="captcha" placeholder="验证码"> <br>
        <input value="{{ captcha.hashkey }}" name="hashkey" type="hidden" id="id_captcha_0">
        <input value="{{ rule_id }}" name="rule_id" type="hidden" id="rule_id">
        <button type="submit" class="btn btn-primary btn-block ">提交</button>
    </form>
<script>
        <!-- 动态刷新验证码js -->
        $(document).ready(function(){
            $('.captcha').click(function () {
                $.getJSON("refresh_captcha/", function (result) {
                    $('#id_captcha').attr('src', result['image_url']);
                    $('#id_captcha_0').val(result['hashkey'])
                });
            });
        });
</script>
</body>
</html>
